import 'package:flutter/material.dart';

class FocusScopeExps extends StatelessWidget {
  const FocusScopeExps({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: GestureDetector(
          onTap: () {
            // 点击空白处时，让输入框失去焦点 → 键盘自动收起
            FocusScope.of(context).unfocus();
          },
          behavior: HitTestBehavior.translucent,
          child: const Padding(
            padding: EdgeInsets.all(16.0),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                TextField(
                  decoration: InputDecoration(
                    labelText: '请输入内容',
                    border: OutlineInputBorder(),
                  ),
                  autofocus: true,
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
